#ifndef __ARRAY_H__
#define __ARRAY_H__

#ifdef __cplusplus
extern "C"
{
#endif
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>

    typedef void (*array_data_deinit_impl)(void *);
    typedef struct array_st
    {
        size_t len;
        size_t cap;
        array_data_deinit_impl deinit_before;
        void **datas;
    } array_t;
    extern array_t *array_init(array_data_deinit_impl deinit_before);
    extern int array_add(array_t *arr, void *data);
    extern int array_insert(array_t *arr, size_t index, void *data);
    extern int array_delete(array_t *arr, size_t index, int del);
    extern int array_update(array_t *arr, size_t index, void *data, int del);
    extern void *array_get(array_t *arr, size_t index);
    extern int array_append(array_t *src, array_t *dst);
    extern int array_append1(array_t *arr, void **datas, size_t data_len);
    extern void array_deinit(array_t **ptr);

#ifdef __cplusplus
}
#endif

#endif